<%@include file="/WEB-INF/jsp/common/header.jsp" %>

<script>
    $(document).ready(function() {

        //MAIN FORM
        //Click Save button
        $("a.save").click(function() {
            $("#user-create-form").submit();
        });
    });
</script>
<div id="Content">
    <div class="metadata">
        <form:form id="user-create-form" modelAttribute="user" action="./create.html" method="POST">

        <c:if test="${user.userId==null}">
            <h2><spring:message code="manage.user.create"/></h2>
        </c:if>
        <c:if test="${user.userId!=null}">
            <h2><spring:message code="manage.user.modify"/></h2>
        </c:if>
        <a class="back action-link" href="./list.html"><spring:message code="back"/></a>
        <a class="save action-link" href="javascript:void(0)"><spring:message code="save"/></a>
        <c:if test="${user.userId!=null}">
            <a class="cancel action-link" href="./delete.html?id=${user.userId}"><spring:message code="delete"/></a>
        </c:if>

    </div>
    <div class="post">
        <div class="entry">
            <div>
                <h2><spring:message code="manage.user.information"/></h2>
            </div>
            <table>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="email" path="email" cssErrorClass="error">
                                <spring:message code="manage.user.email"/>
                            </form:label>
                        </td>
                        <td>
                            <form:input cssClass="store-input" path="email"/><span class="mandatory">*</span>
                            <form:errors path="email" cssClass="error"/>
                        </td>
                        <c:if test="${user.userId!=null}">
                            <form:hidden path="userId"/>
                        </c:if>
                    </div>
                </tr>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="nickname" path="nickname" cssErrorClass="error">
                                <spring:message code="manage.user.nickname"/>
                            </form:label>
                        </td>
                        <td>
                            <form:input cssClass="store-input" path="nickname"/><span class="mandatory">*</span>
                            <form:errors path="nickname" cssClass="error"/>
                        </td>
                    </div>
                </tr>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="lastname" path="lastname" cssErrorClass="error">
                                <spring:message code="manage.user.lastname"/>
                            </form:label>
                        </td>
                        <td>
                            <form:input cssClass="store-input" path="lastname"/><span class="mandatory">*</span>
                            <form:errors path="lastname" cssClass="error"/>
                        </td>
                    </div>
                </tr>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="firstname" path="firstname" cssErrorClass="error">
                                <spring:message code="manage.user.firstname"/>
                            </form:label>
                        </td>
                        <td>
                            <form:input cssClass="store-input" path="firstname"/><span class="mandatory">*</span>
                            <form:errors path="firstname" cssClass="error"/>
                        </td>
                    </div>
                </tr>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="enabled" path="enabled" cssErrorClass="error">
                                <spring:message code="manage.user.enabled"/>
                            </form:label>
                        </td>
                        <td >
                            <form:checkbox path="enabled"/>
                            <form:errors path="enabled" cssClass="error"/>
                        </td>
                    </div>
                </tr>
                <tr>
                    <div class="form-line">
                        <td class="form-table-label">
                            <form:label for="authority" path="authority" cssErrorClass="error">
                                <spring:message code="manage.user.role"/>
                            </form:label>
                        </td>
                        <td>
                            <form:select cssClass="select" path="authority">
                                <form:options items="${appRole}" />
                            </form:select><span class="mandatory">*</span>
                            <form:errors path="authority"/>
                        </td>
                    </div>
                </tr>

            </table>

        </div>
    </div>

    </form:form>
</div>


<%@include file="/WEB-INF/jsp/common/footer.jsp" %>